/*************************************************************************
*filename: lwip_api.h
*description: support api to config or set lwip sub system, or get infomation from lwip sub system
*history:
*-------2018-11-02, change from lwip_stats.h to lwip_api.h
**************************************************************************/

typedef enum
{
  LWIP_NETIF_IF_STATUS_DISABLE   = 0, /* netif down or disable*/
  LWIP_NETIF_IF_STATUS_ACTIVE    = 1, /* netif up or active*/
} lwip_netif_if_status_e;

typedef enum
{
  LWIP_NETIF_IF_HOST_MODE   = 0,   /* netif host mode set, default set for it, config to lan, set by server ip*/
  LWIP_NETIF_IF_CLIENT_MODE = 1,   /* netif client mode set, will get ipconfig from uplink, and config to wan interface */
  LWIP_NETIF_IF_HDHCP_MODE  = 2,   /* netif host mode set, config to lan, but set by dhcp*/
} lwip_netif_if_mode_e;

/*Note: ipv4 and ipv6 both need config to same mode, host or client*/
/* but, can using different client config when in client mode. */
typedef enum
{
  LWIP_NETIF_IP_PROTOCOL_STATIC,     /* ipv4 client mode, need config ip by ifconfig */
  LWIP_NETIF_IP_PROTOCOL_DHCP,       /* ipv4 client mode, will get ip by dhcp */
  LWIP_NETIF_IP6_PROTOCOL_SLAAC,     /* ipv6 client mode, need config ip by ifconfig */
  LWIP_NETIF_IP6_PROTOCOL_DHCP6,     /* ipv6 client mode, will get ip by dhcp */
} lwip_netif_protocol_type_e;

/******************************
*function: lwip_get_netif_*****
*input:
*output:
*       NULL, no if exist
*       netif*, netif pointer
*******************************/
const char* lwip_get_netif_uap_ifname(void);

/******************************
*function: lwip_ifconfig
*input:
*       char* netif_name, the name of netif, list as: cid_4, pc, wlan, local
*       char* config_name, the name of config, list as: ip, gateway, netmask, dns1, dns2
*       char* config_value, the value string, if ip addr, like 8.8.8.8
*
*output:
*       0, if success full
*       -1, if failed
*******************************/
int lwip_ifconfig_value(char* netif_name, char* config_name, int config_value);

/******************************
*function: lwip_iflist
*input:
*       char* netif_name, the name of netif, list as: cid_4, pc, wlan, local
*       char* list_name, the name to list, list as: ip, gateway, netmask, dns1, dns2
*       char* list_value, the value string return, if ip addr, like 8.8.8.8
*
*output:
*       0, if success full
*       -1, if failed
*
*Note:
*       char* list value, is the return string, becareful the size for caller, the least size suggust to 64 bytes
*******************************/
int lwip_iflist(char* netif_name, char* list_name, char* list_value);

/**
* @input onOff 0: not allow to active data, deactive all data connections, 1: allow to active data, and setup default internet connection
* @return 0:OK, -1: ERROR
*/
int32_t CM_SetConnectionSwitch(bool on_off);

/**
* get allow data connection flag
* @return 0: not allow data connection, 1: allow data connection
*/
bool CM_GetConnectionSwitch(void);

void get_ntp_time(void);
